package web;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hibernate.FlushMode;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.springframework.dao.DataAccessResourceFailureException;
 import org.springframework.orm.hibernate3.SessionFactoryUtils;
 import org.springframework.orm.hibernate3.support.OpenSessionInViewFilter;
 
 public class TransactionlessOpenSessionInViewFilter extends
 		OpenSessionInViewFilter {
 	
     protected final Log logger = LogFactory.getLog(TransactionlessOpenSessionInViewFilter.class);
 
 	protected Session getSession(SessionFactory sessionFactory)
 			throws DataAccessResourceFailureException {
 		Session session = SessionFactoryUtils.getSession(sessionFactory, true);
 		session.setFlushMode(FlushMode.AUTO);
 		logger.info("getting session");
 		return session;
 	}
 
 	protected void closeSession(Session session, SessionFactory factory) {
 		logger.info("closing session");
 		session.flush();
 		super.closeSession(session, factory);
 	}
 
 }